package cn.feichanghao.nutz.quickstart.service;

import java.util.List;

import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.service.IdNameEntityService;

import cn.feichanghao.nutz.quickstart.auth.model.Menu;

@IocBean(fields = "dao")
public class MenuService extends IdNameEntityService<Menu> {
	public MenuService() {
		super();
	}

	public MenuService(Dao dao) {
		super(dao);
	}

	public Menu create(String name, String url, String desc) {
		Menu menu = null;
		try {
			menu = this.dao().insert(new Menu(name, url, desc));
		}
		catch (Exception e) {}
		return menu;
	}

	public List<Menu> findAll() {
		List<Menu> menus = null;
		try {
			menus = this.dao().query(Menu.class, null, null);
		}
		catch (Exception e) {}
		return menus;
	}
}
